//
//  BasicBlockUnitTest.cpp
//  ConstructGccfg2.0
//
//  Created by Bryce Holton on 12/7/12.
//  Copyright (c) 2012 Bryce Holton. All rights reserved.
//

#include "BasicBlockUnitTest.h"
#include <assert.h>

void BasicBlockUnitTest::ReplaceChildTest()
{
    BasicBlock *root = new BasicBlock(0);
    BasicBlock *child1 = new BasicBlock(1);
    BasicBlock *child2 = new BasicBlock(2);
    
    root->SetDecendantEdge(*child1);
    root->ReplaceChild(*child1, *child2);
    assert(root->FindChild(*child2));
    
    delete root;
    delete child1;
    delete child2;
}
void BasicBlockUnitTest::RemoveChildTest()
{
    BasicBlock *root = new BasicBlock(0);
    BasicBlock *child1 = new BasicBlock(1);
    
    root->SetDecendantEdge(*child1);
    root->RemoveChild(*child1);
    assert(root->FindChild(*child1) == false);
    
    delete root;
    delete child1;
}
